﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Globalization;
using System.Threading;

namespace QXBook.Handlers.OtherHandlers
{
    public class LanguageHandler : IHttpHandler
    {
        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context)
        {
            string s = context.Request.QueryString["Culture"];
            if (!string.IsNullOrEmpty(s))
            {
                if (context.Response.Cookies["Language"] == null)
                {
                    context.Response.SetCookie(new HttpCookie("Language", s));
                }
                else
                {
                    context.Response.Cookies["Language"].Value = s;
                }
                context.Response.Redirect(context.Request.UrlReferrer.AbsoluteUri);
            }
        }
    }
}